package com.fly.video.downloader;

import com.fly.video.downloader.bean.Video;
import com.fly.video.downloader.layout.fragment.HistoryAdapter;
import com.fly.video.downloader.layout.listener.HistoryListener;
import com.fly.video.downloader.slice.HistoryAbilitySlice;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.ListContainer;

import java.io.Serializable;

public class HistoryAbility extends Ability implements HistoryListener {
    ListContainer recyclerView;
    HistoryAdapter mAdapter;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
//        super.setMainRoute(HistoryAbilitySlice.class.getName());
        super.setUIContent(ResourceTable.Layout_ability_history);
        recyclerView= (ListContainer) findComponentById(ResourceTable.Id_history_list_new);
        mAdapter=new HistoryAdapter(this,this);
        recyclerView.setItemProvider(mAdapter);
    }

    @Override
    public void onListFragmentInteraction(Video video) {
//        ((MainAbility)fragment.getFractionAbility()).onVideoChange(video, true);
        Intent intent=new Intent();
        intent.setParam("video", video);
        setResult(0,intent);
        terminateAbility();
    }
}
